﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls"
                    xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours">

    <ResourceDictionary.MergedDictionaries>
        <!-- MetroScrollViewer -->
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Scrollbars.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type Controls:MetroAnimatedSingleRowTabControl}">
        <Setter Property="Controls:TabControlHelper.Transition"
                Value="Left" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:MetroAnimatedSingleRowTabControl}">
                    <Grid KeyboardNavigation.TabNavigation="Local">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnDefinition0" />
                            <ColumnDefinition x:Name="ColumnDefinition1"
                                              Width="0" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="RowDefinition0"
                                           Height="Auto" />
                            <RowDefinition x:Name="RowDefinition1"
                                           Height="*" />
                        </Grid.RowDefinitions>
                        <ScrollViewer x:Name="HeaderPanelScroll"
                                      Margin="{TemplateBinding TabStripMargin}"
                                      VerticalScrollBarVisibility="Disabled"
                                      HorizontalScrollBarVisibility="Auto"
                                      Style="{DynamicResource MetroScrollViewer}">
                            <TabPanel x:Name="HeaderPanel"
                                      IsItemsHost="True"
                                      Panel.ZIndex="1"
                                      Grid.Column="0"
                                      Grid.Row="0"
                                      KeyboardNavigation.TabIndex="1" />
                        </ScrollViewer>
                        <Controls:TransitioningContentControl x:Name="ContentPanel"
                                                              Transition="{TemplateBinding Controls:TabControlHelper.Transition}"
                                                              Behaviours:ReloadBehavior.OnSelectedTabChanged="True"
                                                              RestartTransitionOnContentChange="True"
                                                              Grid.Column="0"
                                                              Grid.Row="1">
                            <ContentPresenter x:Name="PART_SelectedContentHost"
                                              ContentTemplate="{TemplateBinding SelectedContentTemplate}"
                                              Content="{TemplateBinding SelectedContent}"
                                              ContentStringFormat="{TemplateBinding SelectedContentStringFormat}"
                                              ContentSource="SelectedContent"
                                              Margin="{TemplateBinding Padding}"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </Controls:TransitioningContentControl>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement"
                                 Value="Bottom">
                            <Setter Property="Grid.Row"
                                    TargetName="HeaderPanelScroll"
                                    Value="1" />
                            <Setter Property="Grid.Row"
                                    TargetName="ContentPanel"
                                    Value="0" />
                            <Setter Property="Height"
                                    TargetName="RowDefinition0"
                                    Value="*" />
                            <Setter Property="Height"
                                    TargetName="RowDefinition1"
                                    Value="Auto" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement"
                                 Value="Left">
                            <Setter Property="Controls:TabControlHelper.Transition"
                                    Value="Right" />
                            <Setter Property="Grid.Row"
                                    TargetName="HeaderPanelScroll"
                                    Value="0" />
                            <Setter Property="Grid.Row"
                                    TargetName="ContentPanel"
                                    Value="0" />
                            <Setter Property="Grid.Column"
                                    TargetName="HeaderPanelScroll"
                                    Value="0" />
                            <Setter Property="Grid.Column"
                                    TargetName="ContentPanel"
                                    Value="1" />
                            <Setter Property="Width"
                                    TargetName="ColumnDefinition0"
                                    Value="Auto" />
                            <Setter Property="Width"
                                    TargetName="ColumnDefinition1"
                                    Value="*" />
                            <Setter Property="Height"
                                    TargetName="RowDefinition0"
                                    Value="*" />
                            <Setter Property="Height"
                                    TargetName="RowDefinition1"
                                    Value="0" />
                            <Setter Property="VerticalScrollBarVisibility"
                                    TargetName="HeaderPanelScroll"
                                    Value="Auto" />
                            <Setter Property="HorizontalScrollBarVisibility"
                                    TargetName="HeaderPanelScroll"
                                    Value="Disabled" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement"
                                 Value="Right">
                            <Setter Property="Grid.Row"
                                    TargetName="HeaderPanelScroll"
                                    Value="0" />
                            <Setter Property="Grid.Row"
                                    TargetName="ContentPanel"
                                    Value="0" />
                            <Setter Property="Grid.Column"
                                    TargetName="HeaderPanelScroll"
                                    Value="1" />
                            <Setter Property="Grid.Column"
                                    TargetName="ContentPanel"
                                    Value="0" />
                            <Setter Property="Width"
                                    TargetName="ColumnDefinition0"
                                    Value="*" />
                            <Setter Property="Width"
                                    TargetName="ColumnDefinition1"
                                    Value="Auto" />
                            <Setter Property="Height"
                                    TargetName="RowDefinition0"
                                    Value="*" />
                            <Setter Property="Height"
                                    TargetName="RowDefinition1"
                                    Value="0" />
                            <Setter Property="VerticalScrollBarVisibility"
                                    TargetName="HeaderPanelScroll"
                                    Value="Auto" />
                            <Setter Property="HorizontalScrollBarVisibility"
                                    TargetName="HeaderPanelScroll"
                                    Value="Disabled" />
                            <Setter Property="Controls:ScrollBarHelper.VerticalScrollBarOnLeftSide"
                                    TargetName="HeaderPanelScroll"
                                    Value="True" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
